
import cubeass
import backend
from gettext import gettext as _
from helpers import log

from option import Option

MODE_NORMAL = 1
MODE_STACKMAT = 2
def timer_callback(t):
	log(_('Resulting time')+': '+str(t))
	backend.preprocess_time(round(t,2))


def run(mode=MODE_NORMAL, preinspection = 0, callback = timer_callback):
	if mode==MODE_NORMAL:
		log(_('Running timer'))
		preinsp=Option().windowMain.preinspection.get_value_as_int()
		cubeass.timerCallback(callback)
		cubeass.timerRun(preinsp)	
	elif mode==MODE_STACKMAT:
		log(_('Running timer'))
		cubeass.timerCallback(callback)
		cubeass.timerRunStackmat()	

def init():
	pass
